<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
ArrayUtil (POI API Documentation)
</TITLE>

<META NAME="keywords" CONTENT="org.apache.poi.util.ArrayUtil class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="ArrayUtil (POI API Documentation)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/ArrayUtil.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../org/apache/poi/util/Beta.html" title="annotation in org.apache.poi.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?org/apache/poi/util/ArrayUtil.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="ArrayUtil.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.poi.util</FONT>
<BR>
Class ArrayUtil</H2>
<PRE>
java.lang.Object
  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.poi.util.ArrayUtil</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>ArrayUtil</B><DT>extends java.lang.Object</DL>
</PRE>

<P>
Utility classes for dealing with arrays.
<P>

<P>
<DL>
<DT><B>Author:</B></DT>
  <DD>Glen Stampoultzis</DD>
</DL>
<HR>

<P>

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/poi/util/ArrayUtil.html#ArrayUtil()">ArrayUtil</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/poi/util/ArrayUtil.html#arraycopy(byte[], int, byte[], int, int)">arraycopy</A></B>(byte[]&nbsp;src,
          int&nbsp;src_position,
          byte[]&nbsp;dst,
          int&nbsp;dst_position,
          int&nbsp;length)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is really a debugging version of <code>System.arraycopy()</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/poi/util/ArrayUtil.html#arrayMoveWithin(java.lang.Object[], int, int, int)">arrayMoveWithin</A></B>(java.lang.Object[]&nbsp;array,
                int&nbsp;moveFrom,
                int&nbsp;moveTo,
                int&nbsp;numToMove)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Moves a number of entries in an array to another point in the array,
  shifting those inbetween as required.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/poi/util/ArrayUtil.html#copyOf(byte[], int)">copyOf</A></B>(byte[]&nbsp;source,
       int&nbsp;newLength)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies the specified array, truncating or padding with zeros (if
 necessary) so the copy has the specified length.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE>&lt;T&gt; T[]</CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/poi/util/ArrayUtil.html#copyOf(T[], T[])">copyOf</A></B>(T[]&nbsp;source,
       T[]&nbsp;result)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies the specified array into specified result array, truncating or
 padding with zeros (if necessary) so the copy has the specified length.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/poi/util/ArrayUtil.html#copyOfRange(byte[], int, int)">copyOfRange</A></B>(byte[]&nbsp;original,
            int&nbsp;from,
            int&nbsp;to)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies the specified range of the specified array into a new array.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="ArrayUtil()"><!-- --></A><H3>
ArrayUtil</H3>
<PRE>
public <B>ArrayUtil</B>()</PRE>
<DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="arraycopy(byte[], int, byte[], int, int)"><!-- --></A><H3>
arraycopy</H3>
<PRE>
public static void <B>arraycopy</B>(byte[]&nbsp;src,
                             int&nbsp;src_position,
                             byte[]&nbsp;dst,
                             int&nbsp;dst_position,
                             int&nbsp;length)</PRE>
<DL>
<DD>This is really a debugging version of <code>System.arraycopy()</code>.
 Use it to provide better exception messages when copying arrays around.
 For production use it's better to use the original for speed.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="arrayMoveWithin(java.lang.Object[], int, int, int)"><!-- --></A><H3>
arrayMoveWithin</H3>
<PRE>
public static void <B>arrayMoveWithin</B>(java.lang.Object[]&nbsp;array,
                                   int&nbsp;moveFrom,
                                   int&nbsp;moveTo,
                                   int&nbsp;numToMove)</PRE>
<DL>
<DD>Moves a number of entries in an array to another point in the array,
  shifting those inbetween as required.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - The array to alter<DD><CODE>moveFrom</CODE> - The (0 based) index of the first entry to move<DD><CODE>moveTo</CODE> - The (0 based) index of the positition to move to<DD><CODE>numToMove</CODE> - The number of entries to move</DL>
</DD>
</DL>
<HR>

<A NAME="copyOf(byte[], int)"><!-- --></A><H3>
copyOf</H3>
<PRE>
public static byte[] <B>copyOf</B>(byte[]&nbsp;source,
                            int&nbsp;newLength)</PRE>
<DL>
<DD>Copies the specified array, truncating or padding with zeros (if
 necessary) so the copy has the specified length. This method is temporary
 replace for Arrays.copyOf() until we start to require JDK 1.6.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>source</CODE> - the array to be copied<DD><CODE>newLength</CODE> - the length of the copy to be returned
<DT><B>Returns:</B><DD>a copy of the original array, truncated or padded with zeros to
         obtain the specified length
<DT><B>Throws:</B>
<DD><CODE>java.lang.NegativeArraySizeException</CODE> - if <tt>newLength</tt> is negative
<DD><CODE>java.lang.NullPointerException</CODE> - if <tt>original</tt> is null</DL>
</DD>
</DL>
<HR>

<A NAME="copyOf(java.lang.Object,java.lang.Object)"><!-- --></A><A NAME="copyOf(T[], T[])"><!-- --></A><H3>
copyOf</H3>
<PRE>
public static &lt;T&gt; T[] <B>copyOf</B>(T[]&nbsp;source,
                             T[]&nbsp;result)</PRE>
<DL>
<DD>Copies the specified array into specified result array, truncating or
 padding with zeros (if necessary) so the copy has the specified length.
 This method is temporary replace for Arrays.copyOf() until we start to
 require JDK 1.6.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>source</CODE> - the array to be copied<DD><CODE>result</CODE> - the array to be filled and returned
<DT><B>Throws:</B>
<DD><CODE>java.lang.NegativeArraySizeException</CODE> - if <tt>newLength</tt> is negative
<DD><CODE>java.lang.NullPointerException</CODE> - if <tt>original</tt> is null</DL>
</DD>
</DL>
<HR>

<A NAME="copyOfRange(byte[], int, int)"><!-- --></A><H3>
copyOfRange</H3>
<PRE>
public static byte[] <B>copyOfRange</B>(byte[]&nbsp;original,
                                 int&nbsp;from,
                                 int&nbsp;to)</PRE>
<DL>
<DD>Copies the specified range of the specified array into a new array.
 The initial index of the range (<tt>from</tt>) must lie between zero
 and <tt>original.length</tt>, inclusive.  The value at
 <tt>original[from]</tt> is placed into the initial element of the copy
 (unless <tt>from == original.length</tt> or <tt>from == to</tt>).
 Values from subsequent elements in the original array are placed into
 subsequent elements in the copy.  The final index of the range
 (<tt>to</tt>), which must be greater than or equal to <tt>from</tt>,
 may be greater than <tt>original.length</tt>, in which case
 <tt>(byte)0</tt> is placed in all elements of the copy whose index is
 greater than or equal to <tt>original.length - from</tt>.  The length
 of the returned array will be <tt>to - from</tt>.

 This method is temporary
 replace for Arrays.copyOfRange() until we start to require JDK 1.6.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>original</CODE> - the array from which a range is to be copied<DD><CODE>from</CODE> - the initial index of the range to be copied, inclusive<DD><CODE>to</CODE> - the final index of the range to be copied, exclusive.
     (This index may lie outside the array.)
<DT><B>Returns:</B><DD>a new array containing the specified range from the original array,
     truncated or padded with zeros to obtain the required length
<DT><B>Throws:</B>
<DD><CODE>java.lang.ArrayIndexOutOfBoundsException</CODE> - if <tt>from &lt; 0</tt>
     or <tt>from &gt; original.length()</tt>
<DD><CODE>java.lang.IllegalArgumentException</CODE> - if <tt>from &gt; to</tt>
<DD><CODE>java.lang.NullPointerException</CODE> - if <tt>original</tt> is null<DT><B>Since:</B></DT>
  <DD>1.6</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/ArrayUtil.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../org/apache/poi/util/Beta.html" title="annotation in org.apache.poi.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?org/apache/poi/util/ArrayUtil.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="ArrayUtil.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

                <i>Copyright 2014 The Apache Software Foundation or
        its licensors, as applicable.</i>
            
</BODY>
</HTML>
